﻿using UnityEngine;

namespace winS.UnityEditor.ProcessEditor
{
    public readonly struct ElementMoveInfo
    {
        public Vector2 currentPosition => graphElement.position;
        public readonly Vector2 oldPosition;
        public readonly Vector2 newPosition;

        public readonly GraphElement graphElement;

        public ElementMoveInfo(GraphElement graphElement, Vector2 oldPosition)
        {
            this.graphElement = graphElement;
            this.oldPosition = newPosition = oldPosition;
        }
        private ElementMoveInfo(GraphElement graphElement, Vector2 oldPosition, Vector2 newPosition)
        {
            this.graphElement = graphElement;
            this.oldPosition = oldPosition;
            this.newPosition = newPosition;
        }

        public ElementMoveInfo Build()
        {
            return new ElementMoveInfo(graphElement, oldPosition, graphElement.position);
        }
    }
}